<!DOCTYPE html>
<html lang="en">
<head>
  <title>ottfe.cn</title>
</head>
<body>
  <script>
    const es = new EventSource('/v1/index/es')
    es.onopen = () => {
      console.log('es open')
    }
    es.onerror = (err) => {
      console.log('err', err)
    }
    es.addEventListener('test', (res) => {
      const { data } = res
      console.log('来自服端消息：', data)
    })
  </script>
</body>
</html>